package fr.inria.zvtm.animation;

import fr.inria.zvtm.animation.Animation;
import fr.inria.zvtm.animation.DefaultTimingHandler;
import fr.inria.zvtm.animation.EndAction;

public abstract class ActionTimingHandler extends DefaultTimingHandler {

	private EndAction endAction;

	public ActionTimingHandler() {

	}

	@Override
	public void end(Object subject, Animation.Dimension dim) {
		if (null != endAction) {
			endAction.execute(subject, dim);
		}
	}

	public static void setEndAction(Animation a, EndAction endAction) {
		if (a.handler instanceof ActionTimingHandler) {
			((ActionTimingHandler) a.handler).setEndAction(endAction);
		}
	}

	public void setEndAction(EndAction endAction) {
		this.endAction = endAction;
	}

}
